// scaup
// (c) 2010, Normen Müller, normen.mueller@gmail.com  
// $Id: Iterables.scala 97 2010-08-23 09:00:50Z normen.mueller $
package scaup.data

/** @thanks  Scalaz#Iterables
 *  @author  <a href="mailto:normen.mueller@googlemail.com">Normen M&#xFC;ller</a>
 *  @version 0.0.6
 */
trait Iterables {
  implicit def JavaIterableTo[T](i: java.lang.Iterable[T]): Iterable[T] = new Iterable[T] {
    val k = i.iterator
    override def iterator = new Iterator[T] {
      def hasNext = k.hasNext
      def next = k.next
    }
  }

  implicit def JavaIterableFrom[T](k: Iterable[T]): java.lang.Iterable[T] = new java.lang.Iterable[T] {
    val i = k.iterator
    def iterator = new java.util.Iterator[T] {
      def hasNext = i.hasNext
      def next = i.next
      def remove = error("not supported")
    }
  }
}
